package org.aceor.mddal.atom;

import org.apache.commons.dbcp.BasicDataSource;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.logging.Logger;

/**
 * Created by lxue on 16/3/27.
 */
public class DelegateDBCPDatasource extends BasicDataSource {
    @Override
    public Logger getParentLogger() throws SQLFeatureNotSupportedException {
        return null;
    }

    public Connection getConnection() throws SQLException {
        Connection connection = super.getConnection();
        return new AtomConnectionWrapper(connection, this);
    }

    public Connection getConnection(String username, String password)
            throws SQLException {
        Connection connection = super.getConnection(username, password);
        return new AtomConnectionWrapper(connection, this);
    }
}
